require(['../config'],function(){
    require(['jquery','cookie'],function($){
        function Index(){
            this.isCookie();
            this.addListerer();
        }
        $.extend(Index.prototype,{
            isCookie(){
                $.cookie.json=true;
                if($.cookie('user')){
                    location='/html/admin.html';
                }
            },
            addListerer(){
                $('#login').on('click',this.enterPage);
            },
            enterPage(){
                // var formData =new FormData($("#form").get(0));
                // console.log(formData);
                
                $.ajax({
                    url:'/users/login',
                    data:$("#form").serialize(),
                    type:'post',
                    // data:formData,
                    //  processData: false,
                    // contentType:false,
                    // cache: false,
                    success:function(data){
<<<<<<< HEAD
                        $('#form .tip').text(data.res_body.message);
                        if(data.res_body.status){
                        	location='/html/admin.html'
                        }
=======
                        
                         $('#form .tip').text(data.res_body.message);
                         if(data.res_body.status){
                            location='/html/admin.html'
                         }
                       
                  
>>>>>>> ecf24b5f37dc0b9544ca6b093e0e4cba8a09b209
                    }

                }) 
                return false;
            }
        })
        new Index();
    })
})